<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateSettingsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('settings', function (Blueprint $table) {

            $table->id();
            $table->string('title')->comment('标题');
            $table->string('variate')->comment('变量')->index()->unique();
            $table->enum('type', array_keys(get_setting_types()))->default('text')->comment('类型');
            $table->text('value')->nullable()->comment('值');
            $table->string('remark')->nullable()->comment('备注');

            $table->timestamps();
            $table->softDeletes();

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('settings');
    }
}
